//
//  M1HomeDetailsListVC.m
//  NewMarryU
//
//  Created by Cedar on 2018/7/23.
//  Copyright © 2018年 Cedar. All rights reserved.
//

#import "M1HomeDetailsListVC.h"
#import "M1HomeModel.h"
#import "M1DetailsListCell.h"

@interface M1HomeDetailsListVC ()

@property (nonatomic, strong) NSArray *m1_titleArr;

@property (nonatomic, strong) NSArray *m1_dataArr;

@end

@implementation M1HomeDetailsListVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationItem.title = @"基本资料";
    
    self.m1_titleArr = @[@"UID", @"出生日期", @"星座", @"所在地", @"职业", @"来自", @"年收入", @"身高"];
    
    self.m1_dataArr = @[self.m1_model.basic.uid, self.m1_model.basic.birthday, self.m1_model.basic.constellation, self.m1_model.basic.abode, self.m1_model.basic.job, self.m1_model.basic.native_place, self.m1_model.basic.annual_income, self.m1_model.basic.high];
    
    [self.m1_tableView registerClass:[M1DetailsListCell class] forCellReuseIdentifier:m1_tableViewCellIdentifier];
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.m1_titleArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    M1DetailsListCell *cell = [tableView dequeueReusableCellWithIdentifier:m1_tableViewCellIdentifier];
    
    cell.m1_title.text = self.m1_titleArr[indexPath.row];
    
    if ([self.m1_dataArr[indexPath.row] length] <= 0) {
        cell.m1_content.text = @"未填写";
    }else{
        if ([cell.m1_title.text isEqualToString:@"身高"] && [self.m1_dataArr[indexPath.row] length] > 0) {
            cell.m1_content.text = [NSString stringWithFormat:@"%@cm", self.m1_dataArr[indexPath.row]];
        }else{
            cell.m1_content.text = self.m1_dataArr[indexPath.row];
        }
    }
    
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
